{% extends "base_template.html" %}
{% load engine_tags %}
{% load socialaccount %}
{% block headtitle %}Login{% endblock %}
{% block title %}Login{% endblock %}

{% block body %}

    {% if  social_login %}
        <div class="ui segment inputcolor socialbox">
            <div class="ui header">
                <i class="google icon"></i>Social Login
            </div>

            <p>
                Click the link below to log in or sign up automatically:
            </p>

            <div class="ui large list">
                {% for provider in social_login.iterator %}
                    <a class="item" href="{% provider_login_url provider.provider %}">
                        <i class="{{ provider.name|lower }} large icon"></i>
                        {{ provider.name|title }}

                    </a>
                {% endfor %}
            </div>
            <p>
                Social login is used for authentication only.
            </p>
        </div>
    {% endif %}

    <form class="ui form" method="post" action="{% url 'login' %}">

        <div class="ui segment inputcolor socialbox">

            <div class="ui header">
                <i class="user icon"></i>Email Login
            </div>

            {% csrf_token %}

            {{ form.errors }}

            <div class="field">
                <label>Email</label>
                {{ form.email }}
            </div>

            <div class="field">
                <label>Password</label>
                {{ form.password }}
            </div>

            <div class="field">
                <button class="ui primary button" type="submit">
                    <i class="sign in icon"></i>Log In
                </button>

                <a class="ui right floated button" href="#" onclick="window.history.back()">
                    <i class="chevron left icon"></i>Back
                </a>
            </div>

        </div>


    </form>

    <div class="ui center aligned basic segment">


        <a href="{% url 'password_reset' %}"><i class="question circle icon"></i>Forgot your password?</a>
        &bull; <a class="" href="{% url 'signup' %}"><i class="add user icon"></i>Sign up with email</a>
    </div>




{% endblock %}
